<!DOCTYPE html>
<html>

<head lang="en">
    <meta charset="utf-8" />
    <title>cart</title>
    <link rel="stylesheet" type="text/css" href="css/public.css" />
    <link rel="stylesheet" type="text/css" href="css/proList.css" />
</head>

<body>
    <!--------------------------------------cart--------------------->
    <div class="head ding">
        <div class="wrapper clearfix">
            <div class="clearfix" id="top">
                <h1 class="fl"><a href="index.html"></a></h1>
                <div class="fr clearfix" id="top1">
                    <p class="fl"><a href="login.html" id="login">登录</a><a href="#" id="reg">注册</a>
                    </p>
                    <form action="#" method="get" class="fl"><input type="text" placeholder="大学物理" /><input
                            type="button" /></form>
                    <div class="btn fl clearfix"><a href="mygxin.html"><img src="img/grzx.png" /></a><a href="#"
                            class="er1"><img src="img/ewm.png" /></a><a href="cart.html"><img src="img/gwc.png" /></a>
                        <p><a href="#"><img src="img/smewm.png" /></a></p>
                    </div>
                </div>
            </div>
            <ul class="clearfix" id="bott">
                <li><a href="index.html">首页</a></li>
                <li><a href="paint.html">大学通用</a>
                    <div class="sList">
                        <div class="wrapper  clearfix"><a href="paint.html">
                                <dl>
                                    <dt></dt>
                                    <dd>高数类</dd>
                                </dl>
                            </a><a href="paint.html">
                                <dl>
                                    <dt></dt>
                                    <dd>英语类</dd>
                                </dl>
                            </a><a href="paint.html">
                                <dl>
                                    <dt></dt>
                                    <dd>政治类</dd>
                                </dl>
                            </a><a href="paint.html">
                                <dl>
                                    <dt></dt>
                                    <dd>计算机类</dd>
                                </dl>
                            </a><a href="paint.html">
                                <dl>
                                    <dt></dt>
                                    <dd>经济类</dd>
                                </dl>
                            </a></div>
                    </div>
                </li>
                <li><a href="flowerDer.html">专业课书籍&nbsp;</a>
                    <div class="sList2">
                        <div class="clearfix"><a href="flowerDer.html">
                                <dl>
                                    <dt></dt>
                                    <dd>&nbsp;&nbsp;&nbsp;文科&nbsp;&nbsp;&nbsp;</dd>
                                </dl>
                            </a><a href="flowerDer.html">
                                <dl>
                                    <dt></dt>
                                    <dd>理工科</dd>
                                </dl>
                            </a></div>
                    </div>
                </li>
                <li><a href="decoration.html">其他书籍&nbsp;</a>

                </li>

                <li><a>&nbsp;</a></li>
                <li><a href="idea.html">国家类考试资料</a></li>
            </ul>
        </div>
    </div>
    <div class="cart mt">
        <!-----------------logo------------------->
        <!--<div class="logo"><h1 class="wrapper clearfix"><a href="index.html"><img class="fl" src="img/temp/logo.png"></a><img class="top" src="img/temp/cartTop01.png"></h1></div>-->
        <!-----------------site------------------->
        <div class="site">
            <p class=" wrapper clearfix"><span class="fl">购物车</span><img class="top" src="img/temp/cartTop01.png"><a
                    href="index.html" class="fr">继续购物&gt;</a></p>
        </div>
        <!-----------------table------------------->
        <div class="table wrapper">
            <div class="tr">
                <div>商品</div>
                <div>单价</div>
                <div>数量</div>
                <div>小计</div>
                <div>操作</div>
            </div>
            <div id="list"></div>

            <!-- <div class="th">
                <div class="pro clearfix"><label class="fl"><input type="checkbox" /><span></span></label><a class="fl"
                        href="#">
                        <dl class="clearfix">
                            <dt class="fl"><img src="111/02.jpg"></dt>
                            <dd class="fl">
                                <p>橡胶原材料</p>
                                <p>新旧程度:</p>
                                <p>半新</p>
                            </dd>
                        </dl>
                    </a></div>
                <div class="price">￥13.00</div>
                <div class="number">
                    <p class="num clearfix"><img class="fl sub" src="img/temp/sub.jpg"><span class="fl">1</span><img
                            class="fl add" src="img/temp/add.jpg"></p>
                </div>
                <div class="price sAll">￥13.00</div>
                <div class="price"><a class="del" href="#2">删除</a></div>
            </div>
            <div class="th">
                <div class="pro clearfix"><label class="fl"><input type="checkbox" /><span></span></label><a class="fl"
                        href="#">
                        <dl class="clearfix">
                            <dt class="fl"><img src="111/03.jpg"></dt>
                            <dd class="fl">
                                <p>分析化学</p>
                                <p>新旧程度:</p>
                                <p>全新</p>
                            </dd>
                        </dl>
                    </a></div>
                <div class="price">￥27.90</div>
                <div class="number">
                    <p class="num clearfix"><img class="fl sub" src="img/temp/sub.jpg"><span class="fl">1</span><img
                            class="fl add" src="img/temp/add.jpg"></p>
                </div>
                <div class="price sAll">￥27.90</div>
                <div class="price"><a class="del" href="#2">删除</a></div>
            </div>
            <div class="th">
                <div class="pro clearfix"><label class="fl"><input type="checkbox" /><span></span></label><a class="fl"
                        href="#">
                        <dl class="clearfix">
                            <dt class="fl"><img src="111/04.jpg"></dt>
                            <dd class="fl">
                                <p>物理化学</p>
                                <p>新旧程度:</p>
                                <p>半新</p>
                            </dd>
                        </dl>
                    </a></div>
                <div class="price">￥15.00</div>
                <div class="number">
                    <p class="num clearfix"><img class="fl sub" src="img/temp/sub.jpg"><span class="fl">1</span><img
                            class="fl add" src="img/temp/add.jpg"></p>
                </div>
                <div class="price sAll">￥15.00</div>
                <div class="price"><a class="del" href="#2">删除</a></div>
            </div>
            <div class="th">
                <div class="pro clearfix"><label class="fl"><input type="checkbox" /><span></span></label><a class="fl"
                        href="#">
                        <dl class="clearfix">
                            <dt class="fl"><img src="111/05.jpg"></dt>
                            <dd class="fl">
                                <p>单片机原理</p>
                                <p>新旧程度:</p>
                                <p>旧</p>
                            </dd>
                        </dl>
                    </a></div>
                <div class="price">￥7.00</div>
                <div class="number">
                    <p class="num clearfix"><img class="fl sub" src="img/temp/sub.jpg"><span class="fl">1</span><img
                            class="fl add" src="img/temp/add.jpg"></p>
                </div>
                <div class="price sAll">￥7.00</div>
                <div class="price"><a class="del" href="#2">删除</a></div>
            </div>
            <div class="th">
                <div class="pro clearfix"><label class="fl"><input type="checkbox" /><span></span></label><a class="fl"
                        href="#">
                        <dl class="clearfix">
                            <dt class="fl"><img src="111/06.jpg"></dt>
                            <dd class="fl">
                                <p>数控车工</p>
                                <p>新旧程度：</p>
                                <p>较旧</p>
                            </dd>
                        </dl>
                    </a></div>
                <div class="price">￥7.90</div>
                <div class="number">
                    <p class="num clearfix"><img class="fl sub" src="img/temp/sub.jpg"><span class="fl">1</span><img
                            class="fl add" src="img/temp/add.jpg"></p>
                </div>
                <div class="price sAll">￥7.90</div>
                <div class="price"><a class="del" href="#2">删除</a></div>
            </div> -->
            <div class="goOn">空空如也~<a href="index.html">去逛逛</a></div>
            <div class="tr clearfix"><label class="fl"><input class="checkAll" type="checkbox" /><span></span></label>
                <p class="fl"><a href="#">全选</a><a href="#" class="del">删除</a></p>
                <p class="fr"><span>共<small id="sl">0</small>件商品</span><span>合计:&nbsp;<small
                            id="all">￥0.00</small></span><a href="order.html" class="count">结算</a></p>
            </div>
        </div>
    </div>
    <div class="mask"></div>
    <div class="tipDel">
        <p>确定要删除该商品吗？</p>
        <p class="clearfix"><a class="fl cer" id="btn" href="#">确定</a><a class="fr cancel" href="#">取消</a></p>
    </div>
    <!--返回顶部-->
    <div class="gotop"><a href="cart.html">
            <dl>
                <dt><img src="img/gt1.png" /></dt>
                <dd>去购<br />物车</dd>
            </dl>
        </a><a href="#" class="dh">
            <dl>
                <dt><img src="img/gt2.png" /></dt>
                <dd>联系<br />客服</dd>
            </dl>
        </a><a href="mygxin.html">
            <dl>
                <dt><img src="img/gt3.png" /></dt>
                <dd>个人<br />中心</dd>
            </dl>
        </a><a href="#" class="toptop" style="display: none;">
            <dl>
                <dt><img src="img/gt4.png" /></dt>
                <dd>返回<br />顶部</dd>
            </dl>
        </a>
        <p>400-800-8200</p>
    </div>
    <!--footer-->
    <div class="footer">
        <div class="top">
            <div class="wrapper">
                <div class="clearfix"><a href="#2" class="fl"><img src="img/foot1.png" /></a><span
                        class="fl">7天无理由退货</span>
                </div>
                <div class="clearfix"><a href="#2" class="fl"><img src="img/foot2.png" /></a><span
                        class="fl">15天免费换货</span>
                </div>
                <div class="clearfix"><a href="#2" class="fl"><img src="img/foot3.png" /></a><span
                        class="fl">满59包邮</span>
                </div>
                <div class="clearfix"><a href="#2" class="fl"><img src="img/foot4.png" /></a><span
                        class="fl">特色服务</span>
                </div>
            </div>
        </div>
        <p class="dibu">二手书店</p>
    </div>
    <!----------------mask------------------->
    <div class="mask"></div>
    <!-------------------mask内容------------------->

    <div class="pleaseC">
        <p>请选择宝贝</p><img class="off" src="img/temp/off.jpg" />
    </div>
    <script src="js/jquery-1.12.4.min.js" type="text/javascript" charset="utf-8"></script>
    <script src="js/public.js" type="text/javascript" charset="utf-8"></script>
    <script src="js/pro.js" type="text/javascript" charset="utf-8"></script>
    <script src="js/cart.js" type="text/javascript" charset="utf-8"></script>
    <script>
        var baseUrl = "http://127.0.0.1";
        $(function () {
            $.get(`${baseUrl}/findCartList`, function (data) {
                if (data.result == 1) {
                    var html = ""
                    data.cart.forEach(c => {
                        html = html + `<div class="th">
                <div class="pro clearfix"><label class="fl"><input type="checkbox" /><span></span></label><a class="fl"
                        href="#">
                        <dl class="clearfix">
                            <dt class="fl"><img src="${c.logo}"></dt>
                            <dd class="fl">
                                <p>${c.name}</p>
                                <p>新旧程度:</p>
                                <p>${c.oldnew}</p>
                            </dd>
                        </dl>
                    </a></div>
                <div class="price">￥${c.price}</div>
                <div class="number">
                    <p class="num clearfix"><img class="fl sub" src="img/temp/sub.jpg"><span class="fl">1</span><img
                            class="fl add" src="img/temp/add.jpg"></p>
                </div>
                <div class="price sAll">￥${c.price}</div>
                <div class="price"><a onclick="del(${c.id})" class="del" href="#2">删除</a></div>
            </div>`
                    });
                    $("#list").html(html)
                }
            });
        })
        function del(id) {
            $.get(`${baseUrl}/deleteCartById/${id}`, function (data) {
                if (data.result == 1) {

                } else {
                    alert("用户或密码错误！");
                    return;
                }
            });

        }

    </script>
</body>

</html>